<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML>
<html>
<head>
<base href="<%=basePath%>">

<title>规划阶段</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">

<link rel="stylesheet" href="css/vivo.css">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="js/bootstrap2/css/bootstrap.min.css">
<link rel="stylesheet" href="css/common.css">
<link href="js/select2/select2.min.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css"
	href="js/webuploader-0.1.5/webuploader.css" />

<script src="js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="js/layui-v2.1.5/layui/layui.all.js"></script>
<script type="text/javascript"
	src="<%=basePath%>js/My97DatePicker/WdatePicker.js"></script>
<script src="js/select2/select2.min.js"></script>
<script src="js/sharefunction.js"></script>

<script type="text/javascript" src="js/webuploader-0.1.5/webuploader.js"></script>
<script type="text/javascript" src="js/form.js"></script>
<!-- 图片放大 -->
<script src="js/postbird-img-glass/postbird-img-glass.js"></script>

<style type="text/css">
</style>
</head>

<script type="text/javascript">
	$(function() {
		//禁用输入框
		$("#planStageForm").find("input").attr("readonly",true);
		$("#planStageForm").find("select").attr("disabled",true);
		$("#leaseType").select2({
			tags : true
		});
		var s1 = $("#planIndicator").select2();
		initSelectData(s1);
		var planLandPropertyS2=$("#planLandProperty").select2({
			tags : true
		});
		//设置用地性质默认值
		planLandPropertyS2.val("${requestScope.planStage.planLandProperty }").trigger("change");
		initPicEditData();
		getFiles();
	});
	//获取编辑页面图片的数据1222222456 
	function initPicEditData(){
		var fujians = ${requestScope.fujianList};
		//console.log(fujians);
		html="";
		$.each(fujians, function(i,val) {
			var html = "<tr><td style='width: 120px;'>" + val.article + "</td><td><!--上传附件部分--><div style='display: inline-block;'><div id='list_" + val.id + "'></div></div></td>";
			//添加html元素
			$("#addtrtable").append(html);
			//初始化html元素，为其增加附件上传功能
			//initWebUpload("file_" + val.id, "list_" + val.id,val.id, "planStage_articleId", planStageSuccess, planStageErr);
		})
	}
	var isExist="no";
	//展示附件(历史附件)
	function getFiles() {
		var fujians = ${requestScope.fujianList};
		$.each(fujians, function(i,val) {
			getHistoryFileList($("#planStageForm #entityId_id").val(), val.id, "#list_"+val.id, imgPlus);
		});
	}
	
	//上传成功回调
	function planStageSuccess(file, response) {
		PostbirdImgGlass.init({
			domSelector : "td img",
			animation : true,
			myDocument : window.parent.parent.parent
		});
	}
	//上传失败回调
	function planStageErr(file, data) {
		//alert("上传失败回调");
	}
	
	function imgPlus(data) {
		$("#planStageForm .uploadcancel").css("display","none");
			$.each(data, function(i, v) {
			console.log(v.id);
				//图片放大
				PostbirdImgGlass.init({
					domSelector : "#" + v.id + " img",
					animation : true,
					myDocument : window.parent.parent.parent
				});
			});
		}

	function initSelectData(s1) {
		$.getJSON("dictionariesArticle/getDictionariesArticle", {
			classifyId : "规划阶段",
			direction : ""
		}, function(data, status) {
			if (status == "success") {
				$.each(data, function(i, v) {
					var html = "<option value=\"" + v.id + "\">" + v.article + "</option>";
					$("#planIndicator").append(html);
					if (i == 0) {
						s1.val(v.id).trigger("change");
					}
				});
			}
		});
		var arr = [ "规划地段位置图", "规划总平面图", "规划地段现状图", "道路交通规划图", "绿化景观规划图", "综合管网规划图", "竖向规划图", "建筑平、立、剖面图" ];
	}
</script>
<body>
	<div style="padding:0px 10px">
		<form id="planStageForm" method="post"
			action="project/approval/addPlan">
			<!-- 上传文件返回的附件id -->
			<input type="text" id="planStage_articleId"
				name="planStage_articleId" value="" hidden="hidden"
				style="display: none;" />

			<div class="panel panel-default">
				<div class="panel-heading">
					<h5 class="panel-title">控规指标</h5>
				</div>
				<div class="panel-body">
					<table cellpadding="10" cellspacing="5" class="mytable">
						<tr>
							<td width="90">规划时间</td>
							<td width="250"><input name="planDate" class="Wdate"
								value="<fmt:formatDate value="${requestScope.planStage.planDate }" pattern="yyyy-MM-dd" />"
								 /> <span style="color:red">*</span></td>
							<td width="90">规划名称</td>
							<td><input name="planName"
								value="${requestScope.planStage.planName }" /></td>
							<td width="90">占地面积</td>
							<td><input name="planArea"
								value="${requestScope.planStage.planArea }" /> ㎡</td>
						</tr>
						<tr>
							<td width="90">建筑密度</td>
							<td><input name="planBuildingDensity"
								value="${requestScope.planStage.planBuildingDensity }" /> %</td>
							<td width="90">用地性质</td>
							<td><select id="planLandProperty" name="planLandProperty"
								style="width:130px;">
									<c:forEach items="${landPropertyList }" var="p">
										<option value="${p }" selected>${p }</option>
									</c:forEach>
							</select></td>
							<td width="90">限制高度</td>
							<td><input name="planMaxHeight"
								value="${requestScope.planStage.planMaxHeight }" /> m</td>
						</tr>
						<tr>
							<td width="90">绿化率</td>
							<td><input name="planAfforest"
								value="${requestScope.planStage.planAfforest }" /> %</td>
							<td width="90">容积率</td>
							<td colspan="3"><input name="planVolume"
								value="${requestScope.planStage.planVolume }" /> %</td>
						</tr>
						<tr>
							<td width="90">四至红线</td>
							<td colspan="2">东至&nbsp;<input style="width: 290px;"
								name="planEast" value="${requestScope.planStage.planEast }" /></td>
							<td></td>
							<td colspan="2">西至&nbsp;<input style="width: 290px;"
								name="planWest" value="${requestScope.planStage.planWest }" /></td>
						</tr>
						<tr>
							<td width="90"></td>
							<td colspan="2">南至&nbsp;<input style="width: 290px;"
								name="planSouth" value="${requestScope.planStage.planSouth }" /></td>
							<td></td>
							<td colspan="2">北至&nbsp;<input style="width: 290px;"
								name="planNorth" value="${requestScope.planStage.planNorth }" /></td>
						</tr>
					</table>
				</div>
			</div>

			<div class="panel panel-default">
				<div class="panel-heading">
					<h5 class="panel-title">详规指标</h5>
				</div>
				<div class="panel-body">
					<p>
						<span class="style_btn">详规指标</span> <span class="style_input">
							<select class="js-example-basic-single" name="planIndicator"
							id="planIndicator" style="width:160px;">
						</select>
						</span> 
					</p>
					<table id="addtrtable" cellpadding="10" cellspacing="5"
						class="mytable">

					</table>
				</div>
			</div>

			<input type="hidden" id="entityId_id" name="id" value="${requestScope.planStage.id }" />
			<div style="width:100%;text-align:center; padding-top:0px">
					<a class="btn btn-default radius hidbtn" onClick="close();">关闭 </a>
			</div>
		</form>
	</div>
<script type="text/javascript">
	function close(){
		$("#planStageForm").addClass("display","none");
	}
</script>
</body>
</html>

